<?php
namespace app\admin\controller; 
use think\AjaxPage;
use think\Controller;
use think\Url;
use think\Config;
use think\Page;
use think\Verify;
use think\Db;
class Store extends Base {
	
	
	public function index(){
		$store_id = session('store_id');		
		$stores = M('store')->where("store_id=$store_id")->find();		
		$stores['tourl'] = config('HostUrl').'games/dianwu/login.html?storeid='.$store_id.'&type=into';
		$this->assign('info',$stores);
		return $this->fetch();
	}
	
	//信息保存
	public function infosave(){
		$data = I('post.');
        $store_id = session('store_id');
		
		M('store')->where("store_id=$store_id")->save($data);
        adminLog("管理员修改了公司信息 :" . I('name'));
		
//		$this->success("操作成功");
		$this->ajaxReturn(['status' => 1,
            'msg' =>'保存成功']);
		
	}
	
	//创建二维码
	function createQr(){
		$store_id = session('store_id');
		$savePath = '/'.createQr($store_id);
		
		M('store')->where("store_id=$store_id")->save(['qrcode'=>$savePath]);
		
		$this->ajaxReturn(['status' => 1,
            'msg' =>'生成二维码成功','data'=>$savePath]);
	}
}
?>